@page
@{ Layout = "_LayoutHome"; }
@section Styles{
    <style>
        .el-form-item {
            margin-bottom: 0px;
        }

        .el-progress-bar__outer {
            background-color: #fafafa !important;
        }

        body {
            padding: 0;
            margin: 0;
            background-color: #ffffff;
        }

        html {
            padding: 0;
            margin: 0;
            background-color: #ffffff;
        }
    </style>
}
<el-card class="rounded-0">
    <div class="d-flex justify-content-between align-items-center">
        <div>
            <el-page-header v-on:back="goBack" class="d-flex align-items-center">
                <div slot="title" class="pb-1"><span>返回</span></div>
                <div slot="content">
                    <h2 class="h1 fw-bold">刷题记录</h2>
                    <small>共 {{total}} 条</small>
                </div>
            </el-page-header>
        </div>
        <div>
            <el-form v-on:submit.native.prevent :inline="true" :model="form">
                <el-form-item label="">
                    <el-date-picker v-model="form.dateFrom"
                                    type="datetime"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    placeholder="选择开始日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="到">
                    <el-date-picker v-model="form.dateTo"
                                    type="datetime"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    placeholder="选择结束日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" plain icon="el-icon-search" v-on:click="btnSearchClick">查询</el-button>
                    <el-button type="warning" plain icon="el-icon-delete" v-on:click="btnClearClick">清空练习记录</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</el-card>
<div class="p-3">
    <div v-if="total>0">
        <div class="ms-5 position-relative card-hover-with-icon" v-for="(practice,index) in list" v-on:click="goPracticeResult(practice.id)">
            <div class="position-absolute top-50 start-0 translate-middle">
                <div class="position-relative">
                    <i class="el-icon-finished fs-3"></i>
                    <span class="position-absolute top-100 start-100 translate-middle mt-1 fs-6">{{ index+1 }}</span>
                </div>
            </div>
            <el-card class="rounded-0 border-start-0 border-end-0" shadow="hover">
                <div class="row align-items-center g-3 ms-6">
                    <div class="col">
                        <div class="mb-3 fw-bold">
                            <span>{{ practice.title }}</span>
                        </div>
                        <ul class="list-inline fw-light">
                            <li class="list-inline-item">
                                <el-tag>{{ utils.getFriendlyDateTime(practice.createdDate) }}</el-tag>
                            </li>
                            <li class="list-inline-item">
                                共：{{ practice.mineTmCount }}题
                            </li>
                            <li class="list-inline-item">
                                答题：{{ practice.answerCount }}
                            </li>
                            <li class="list-inline-item text-success">
                                正确：{{ practice.rightCount }}
                            </li>
                            <li class="list-inline-item text-danger">
                                错误：{{ practice.answerCount-practice.rightCount }}
                            </li>
                        </ul>
                    </div>
                    <div class="col-auto" style="width:300px;">
                        <div>
                            <div class="text-end"><small>正确率:{{ utils.formatPercentFloat(practice.rightCount, practice.answerCount) }}%</small></div>
                            <div class="progress text-end text-white" aria-valuemin="0" aria-valuemax="100" style="height: 20px;">
                                <div class="progress-bar progress-bar-striped progress-bar-animated bg-success" :style="'width:'+utils.formatPercentFloat(practice.rightCount, practice.answerCount)+'%'"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </el-card>
        </div>
        <div class="my-5 text-center">
            <el-button icon="el-icon-refresh-right" v-if="list.length>0 && list.length<total" v-on:click="btnLoadMoreClick" :loading="loadMoreLoading">加载更多</el-button>
            <small v-else>没有更多了</small>
        </div>
    </div>
    <div class="pt-10" v-else>
        <el-empty image="/sitefiles/assets/images/nodata.svg"></el-empty>
    </div>
</div>

@section Scripts{
    <script src="/sitefiles/assets/js/home/exam/examPracticeLog.js" type="text/javascript"></script>
}